package com.scalar.forecast.forecastEntry.actions;

import com.scalar.forecast.ForecastExtendedAction;
import com.scalar.forecast.actionCommands.ActionCommand;
import com.scalar.forecast.forecastEntry.actionCommands.ForecastEntryExportToActionCommandFactory;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Action Class to process request came from the export to link..
 * User: Sujan
 * Date: Feb 24, 2005
 * Time: 6:03:05 PM
 */
public class ForecastEntryExportToAction extends ForecastExtendedAction
{
    public ActionForward executeRequest(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {
        ActionForward actionForward = mapping.findForward ( "success" );
        String action = request.getParameter ( "action" );
        if ( action == null )
        {
            action = ACTION_EXPORT_TO_XLS;
        }
        ActionCommand actionCommand = ForecastEntryExportToActionCommandFactory.getActionCommand( action );
        if ( actionCommand != null)
        {
            actionForward = actionCommand.execute( mapping, form, request, response );
        }
        return actionForward;
    }
}
